<?php

namespace App\Admin\Controllers;

use App\Models\EmailWait;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class EmailWaitController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '等待发送的邮箱';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new EmailWait);

        $grid->column('email_content_id', __('Email content id'));
        $grid->column('status', __('Status'));
        $grid->column('content', __('Content'));
        $grid->column('created_at', __('Created at'));
        $grid->column('deleted_at', __('Deleted at'));
        $grid->column('updated_at', __('Updated at'));
        $grid->column('site_id', __('Site id'));

        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(EmailWait::findOrFail($id));

        $show->field('email_content_id', __('Email content id'));
        $show->field('status', __('Status'));
        $show->field('content', __('Content'));
        $show->field('created_at', __('Created at'));
        $show->field('deleted_at', __('Deleted at'));
        $show->field('updated_at', __('Updated at'));
        $show->field('site_id', __('Site id'));

        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new EmailWait);
        $form->switch('status', __('Status'));
        $form->textarea('content', __('Content'));
        $form->number('site_id', __('Site id'));
        return $form;
    }
}
